<template>
  <el-dropdown size="small" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis">
    <span class="el-dropdown-link">
      <i class="el-icon-more el-icon--right" style="color: #409EFF;"></i>
    </span>
    <el-dropdown-menu slot="dropdown">
      <el-dropdown-item v-for='(item,index) in events' :key="index" :divided="index >0" @click.native="clickMenu(item)">
        {{item.label}}
      </el-dropdown-item>
    </el-dropdown-menu>
  </el-dropdown>
</template>

<script>
export default {
  name: "DotDropDown",
  props: {
    events: {
      type: Array,
      default: function() {
        return [
          {
            label: '新建同级',
            funcName: 'addPeerFolder'
          },
          {
            label: '新建子级',
            funcName: 'addSubFolder'
          },
          {
            label: '重命名',
            funcName: 'renameFolder'
          },
          {
            label: '删除',
            funcName: 'delFolder'
          }
        ]
      }
    },
    // 注入数据
    data: {
      type: Object
    }
  },
  methods: {
    clickMenu(item) {
      this.$emit(item.funcName, this.data)
    }
  }
}
</script>

<style scoped>
.el-icon-more:before {
  content: "\E794";
  font-size: 14px;
}
</style>
